from selenium.webdriver.common.by import By
from po.Base.Base import Base
import time
class Page2(Base):
    # 点击团购
    # 绝对路径
    pt=(By.XPATH,'/html/body/div[3]/div[2]/ul/li[5]/a')
    def pt_loc(self):
        self.click(self.pt)
    # 点击商品
    # 相对路径
    sp=(By.XPATH,'/html/body/div[5]/div[2]/div[2]/div[1]/ul/li[1]/div[1]/span/a/img')
    def sp_loc(self):
        self.click(self.sp)
    #    点击立即购买
    goumai=(By.ID,'buy-cart')
    def goumai_loc(self):
        self.click(self.goumai)
    # 点击提交 id="order-button"，class="ask-btn"
    tj=(By.XPATH,'//a[@id="order-button" and @class="ask-btn"]')
    def tj_loc(self):
        self.click(self.tj)
    # 断言
    dy1=(By.XPATH,'//span[contains(@class,"succe-ico")]')
    def dy1_loc(self):
        return self.text(self.dy1)
    # 点击积分商城
    jf=(By.XPATH,'/html/body/div[3]/div[2]/ul/li[6]/a')
    def jf_loc(self):
        self.click(self.jf)

    def a3mall_tuangou(self):
        self.pt_loc()
        time.sleep(2)
        self.sp_loc()
        time.sleep(2)
        self.goumai_loc()
        time.sleep(2)
        self.tj_loc()
        assert '您的订单支付成功' == self.dy1_loc()
        time.sleep(2)
        self.jf_loc()
